import type { FormSchema } from '@/components/core/schema-form/';
import type { TableColumn } from '@/components/core/dynamic-table';

export interface TableListItem {
  id: string;
  name: string;
  imageMD5: string;
  active: boolean;
  CreatTime: string;
}

export type TableColumnItem = TableColumn<TableListItem>;

// 表格列配置
export const baseColumns: TableColumnItem[] = [
  {
    title: '知识库名称',
    dataIndex: 'name',
    width: 200,
    align: 'left',
  },
  {
    title: '状态',
    dataIndex: 'active',
    width: 80,
    customRender: ({ record }) => {
      return record.active ? '启用' : '停用';
    },
  },
  {
    title: '创建时间',
    dataIndex: 'creatTime',
    width: 160,
  },
];

// 搜索表单配置
export const searchFormSchema: FormSchema[] = [
  {
    field: 'name',
    component: 'Input',
    label: '知识库名称',
    componentProps: {
      placeholder: '请输入知识库名称',
    },
    colProps: {
      lg: 12,
      md: 24,
    },
  },
  {
    field: 'active',
    component: 'Select',
    label: '状态',
    componentProps: {
      placeholder: '请选择状态',
      options: [
        {
          label: '启用',
          value: true,
        },
        {
          label: '停用',
          value: false,
        },
      ],
    },
    colProps: {
      lg: 12,
      md: 24,
    },
  },
]; 